﻿using System;
using System.Collections.Generic;
using Interfaces.Criteria;
using Interfaces.Filters;
using Interfaces.Repositories;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using SQLRepositories;
using SQLRepositories.EconomicRepositories;

namespace DataProviderIntegrationTests.RepositoryTests
{
    [TestClass]
    public class SectorRepositoryTests
    {
        private readonly SectorRepository _repository = new SectorRepository(new DBEconomicInformationServiceContext());
        
        [TestMethod]
        public void SectorRepository_GetData_FullLoading()
        {
            TestsHelper.CreateEconomicTestData();
            var mockCriteria = new Mock<IBaseCriteria>();
            var mockFilter = new Mock<ISectorsFilter>();
            mockCriteria.Setup(x => x.IsFullLoading).Returns(true);
            mockCriteria.Setup(x => x.IsLazyLoading).Returns(false);
            mockFilter.Setup(x => x.Filtrate(It.IsAny<IEnumerable<object>>())).Returns((IEnumerable<object> y) => y);
            var data = _repository.GetData(mockCriteria.Object, mockFilter.Object);
            Assert.IsNotNull(data);
            foreach (var industrySector in data)
            {
                Assert.IsNotNull(industrySector.Industries);
            }
        }
    }
}
